<!DOCTYPE HTML>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0"/>
    <meta name="format-detection" content="telephone=no,email=no,date=no,address=no">
    <title>我提交的</title>
    <link rel="stylesheet" href="../css/mui.min.css">
    <link rel="stylesheet" href="../css/image.css">
    <link rel="stylesheet" type="text/css" href="../css/api.css" />
    <link rel="stylesheet" type="text/css" href="../css/aui.css" />
</head>
<style>
    .file-upload{ float: left; width: 3rem; height: 3rem; margin-top: .8rem; margin-left: .8rem; text-align: center;line-height: 3rem; overflow: hidden; position: relative; }
    .icon {
       width: 1em; height: 1em;
       vertical-align: -0.2em;
       fill: currentColor;
       overflow: hidden;
    }

    .bottom{ margin-bottom: 10px; }

</style>
<body>
    <div class="aui-content aui-margin-b-15">
        <ul class="aui-list aui-form-list aui-margin-t-15">
            <li class="aui-list-item">
                <div class="aui-list-item-inner">
                    <div class="aui-list-item-label">
                        提交时间：
                    </div>
                    <div class="aui-list-item-input">
                        <input type="text" id="addtime" readonly>
                    </div>
                </div>
            </li>
        </ul>
        <ul class="aui-list aui-form-list aui-margin-t-15">
            <li class="aui-list-item">
                <div class="aui-list-item-inner">
                    <div class="aui-list-item-label">
                        审批状态：
                    </div>
                    <div class="aui-list-item-input">
                        <input type="text" id="status" readonly>
                    </div>
                </div>
            </li>
            <li class="aui-list-item">
                <div class="aui-list-item-inner">
                    <div class="aui-list-item-label">
                        审批时间：
                    </div>
                    <div class="aui-list-item-input">
                        <input type="text" id="status_time" readonly>
                    </div>
                </div>
            </li>
        </ul>
        <ul class="aui-list aui-form-list aui-margin-t-15">
            <li class="aui-list-item">
                <div class="aui-list-item-inner">
                    <div class="aui-list-item-label">
                        审批意见：
                    </div>
                    <div class="aui-list-item-input">
                        <textarea id="status_reason" readonly></textarea>
                    </div>
                </div>
            </li>
        </ul>
    </div>

    <div class="aui-content aui-margin-b-15" id="workflow_leave" style="display: none;">
        <ul class="aui-list aui-form-list aui-margin-t-15">
            <li class="aui-list-item">
                <div class="aui-list-item-inner">
                    <div class="aui-list-item-label">
                        请假类型：
                    </div>
                    <div class="aui-list-item-input">
                        <input type="text" id="leave_leavetype" readonly>
                    </div>
                </div>
            </li>
        </ul>

        <ul class="aui-list aui-form-list aui-margin-t-15">
            <li class="aui-list-item">
                <div class="aui-list-item-inner">
                    <div class="aui-list-item-label">
                        开始时间：
                    </div>
                    <div class="aui-list-item-input">
                        <input type="text" id="leave_starttime" readonly>
                    </div>
                </div>
            </li>
            <li class="aui-list-item">
                <div class="aui-list-item-inner">
                    <div class="aui-list-item-label">
                        结束时间：
                    </div>
                    <div class="aui-list-item-input">
                        <input type="text" id="leave_endtime" readonly>
                    </div>
                </div>
            </li>
            <li class="aui-list-item">
                <div class="aui-list-item-inner">
                    <div class="aui-list-item-label">
                        请假时长：
                    </div>
                    <div class="aui-list-item-input">
                        <input type="text" id="leave_timelength" readonly>
                    </div>
                </div>
            </li>
        </ul>

        <ul class="aui-list aui-form-list aui-margin-t-15">
            <li class="aui-list-item">
                <div class="aui-list-item-inner">
                    <div class="aui-list-item-label">
                        请假事由：
                    </div>
                    <div class="aui-list-item-input">
                        <textarea id="leave_reason" readonly></textarea>
                    </div>
                </div>
            </li>
        </ul>
        

        <ul class="aui-list aui-form-list aui-margin-t-15">
            <li class="aui-list-item">
                <div class="aui-list-item-inner">
                    <div class="aui-list-item-label">
                        附件：
                    </div>
                </div>
            </li>
            <li style="height: 4.6rem;">
                <div id="leave_file">
                    <!-- <div class="aui-border aui-text-center file-upload"><img src="../image/demo1.png" alt=""></div> -->
                </div>
            </li>
        </ul>
    </div>

    <div class="aui-content aui-margin-b-15" id="workflow_outside" style="display: none;">
        <ul class="aui-list aui-form-list aui-margin-t-15">
            <li class="aui-list-item">
                <div class="aui-list-item-inner">
                    <div class="aui-list-item-label">
                        开始时间：
                    </div>
                    <div class="aui-list-item-input">
                        <input type="text" id="outside_starttime" readonly>
                    </div>
            
                </div>
            </li>
            <li class="aui-list-item">
                <div class="aui-list-item-inner">
                    <div class="aui-list-item-label">
                        结束时间：
                    </div>
                    <div class="aui-list-item-input">
                        <input type="text" id="outside_endtime" readonly>
                    </div>
            
                </div>
            </li>
            <li class="aui-list-item">
                <div class="aui-list-item-inner">
                    <div class="aui-list-item-label">
                        外勤时长：
                    </div>
                    <div class="aui-list-item-input">
                        <input type="text" id="outside_timelength" readonly>
                    </div>
                </div>
            </li>
            <li class="aui-list-item">
                <div class="aui-list-item-inner">
                    <div class="aui-list-item-label">
                        外勤地点：
                    </div>
                    <div class="aui-list-item-input">
                        <input type="text" id="outside_place" readonly>
                    </div>
                </div>
            </li>
        </ul>

        <ul class="aui-list aui-form-list aui-margin-t-15">
            <li class="aui-list-item">
                <div class="aui-list-item-inner">
                    <div class="aui-list-item-label">
                        外勤事件：
                    </div>
                    <div class="aui-list-item-input">
                        <textarea id="outside_reason" readonly></textarea>
                    </div>
                </div>
            </li>
        </ul>
        <ul class="aui-list aui-form-list aui-margin-t-15">
            <li class="aui-list-item">
                <div class="aui-list-item-inner">
                    <div class="aui-list-item-label">
                        附件：
                    </div>
                </div>
            </li>
            <li style="height: 4.6rem;">
                <div id="outside_file">
                    <!-- <div class="aui-border aui-text-center file-upload"><img src="../image/demo1.png" alt=""></div> -->
                </div>
            </li>
        </ul>
    </div>

    <div class="aui-content aui-margin-b-15" id="workflow_travel" style="display: none;">
        <ul class="aui-list aui-form-list aui-margin-t-15">
            <li class="aui-list-item">
                <div class="aui-list-item-inner">
                    <div class="aui-list-item-label">
                        开始时间：
                    </div>
                    <div class="aui-list-item-input">
                        <input type="text" id="travel_starttime" readonly>
                    </div>
            
                </div>
            </li>
            <li class="aui-list-item">
                <div class="aui-list-item-inner">
                    <div class="aui-list-item-label">
                        结束时间：
                    </div>
                    <div class="aui-list-item-input">
                        <input type="text" id="travel_endtime" readonly>
                    </div>
            
                </div>
            </li>
            <li class="aui-list-item">
                <div class="aui-list-item-inner">
                    <div class="aui-list-item-label">
                        出差时长：
                    </div>
                    <div class="aui-list-item-input">
                        <input type="text" id="travel_timelength" readonly>
                    </div>
                </div>
            </li>
            <li class="aui-list-item">
                <div class="aui-list-item-inner">
                    <div class="aui-list-item-label">
                        出差地点：
                    </div>
                    <div class="aui-list-item-input">
                        <input type="text" id="travel_place" readonly>
                    </div>
                </div>
            </li>
        </ul>

        <ul class="aui-list aui-form-list aui-margin-t-15">
            <li class="aui-list-item">
                <div class="aui-list-item-inner">
                    <div class="aui-list-item-label">
                        出差原因：
                    </div>
                    <div class="aui-list-item-input">
                        <textarea id="travel_reason" readonly></textarea>
                    </div>
                </div>
            </li>
        </ul>
        <ul class="aui-list aui-form-list aui-margin-t-15">
            <li class="aui-list-item">
                <div class="aui-list-item-inner">
                    <div class="aui-list-item-label">
                        附件：
                    </div>
                </div>
            </li>
            <li style="height: 4.6rem;">
                <div id="travel_file">
                    <!-- <div class="aui-border aui-text-center file-upload"><img src="../image/demo1.png" alt=""></div> -->
                </div>
            </li>
        </ul>
    </div>

    <div class="aui-content aui-margin-b-15" id="workflow_reimbursement" style="display: none;">
        <ul class="aui-list aui-form-list aui-margin-t-15">
            <li class="aui-list-item">
                <div class="aui-list-item-inner">
                    <div class="aui-list-item-label">
                        消费日期：
                    </div>
                    <div class="aui-list-item-input">
                        <input type="text" id="reimbursement_starttime" readonly>
                    </div>
            
                </div>
            </li>
        </ul>
        <ul class="aui-list aui-form-list aui-margin-t-15">
            <li class="aui-list-item">
                <div class="aui-list-item-inner">
                    <div class="aui-list-item-label">
                        报销金额：
                    </div>
                    <div class="aui-list-item-input">
                        <input type="text" id="reimbursement_reimbursement" readonly>
                    </div>
                </div>
            </li>
        </ul>

        <ul class="aui-list aui-form-list aui-margin-t-15">
            <li class="aui-list-item">
                <div class="aui-list-item-inner">
                    <div class="aui-list-item-label">
                        报销原因：
                    </div>
                    <div class="aui-list-item-input">
                        <textarea id="reimbursement_reason" readonly></textarea>
                    </div>
                </div>
            </li>
        </ul>
        <ul class="aui-list aui-form-list aui-margin-t-15">
            <li class="aui-list-item">
                <div class="aui-list-item-inner">
                    <div class="aui-list-item-label">
                        票据核对：
                    </div>
                </div>
            </li>
            <li style="height: 4.6rem;">
                <div id="reimbursement_file">
                    <!-- <div class="aui-border aui-text-center file-upload"><img src="../image/demo1.png" alt=""></div> -->
                </div>
            </li>
        </ul>
    </div>

</body>
<script type="text/javascript" src="../script/api.js"></script>
<script type="text/javascript" src="../script/zepto.min.js" ></script>
<script type="text/javascript" src="../css/font/iconfont.js" ></script>
<script src="../script/mui/mui.min.js"></script>
<script src="../script/mui/mui.zoom.js"></script>
<script src="../script/mui/mui.previewimage.js"></script>
<script type="text/javascript">
    mui.previewImage();
    apiready = function(){
        // alert(api.pageParam.type)
        // 加载页面
        var type = api.pageParam.type + '';
        show(type);
        // 加载页面
        load();
    };

    function load() {
        api.ajax({
            url: ServeUrl + 'm=Workflow&a=getWorkDetail',
            method: 'post',
            dataType : 'json',
            data: {
                values: {
                    id : api.pageParam.id,
                },
            },
        }, function(ret, err) {
            // alert(JSON.stringify(ret));
            if (ret) {
                switch (ret.type) {
                    case '1': var work = 'leave'; break;
                    case '2': var work = 'outside'; break;
                    case '3': var work = 'travel'; break;
                    case '4': var work = 'reimbursement'; break;
                    default : return false;
                }
                $('#addtime').val(ret.addtime);
                if (ret.status == 0) {
                    $('#status').val('办理中');
                } else if (ret.status == 1) {
                    $('#status').val('同意');
                    $('#status_reason').val(ret.status_reason);
                    $('#status_time').val(ret.status_time);
                } else {
                    $('#status').val('驳回');
                    $('#status_reason').val(ret.status_reason);
                    $('#status_time').val(ret.status_time);
                }
                for (var key in ret) {
                    // alert(key);
                    var htmlObj = work + '_' + key;
                    if (document.getElementById(htmlObj)) {
                        if (key == 'leavetype') {
                            switch (ret[key]) {
                                case '1': var leavetypeStr = '事假'; break;
                                case '2': var leavetypeStr = '病假'; break;
                                case '3': var leavetypeStr = '年假'; break;
                                case '4': var leavetypeStr = '婚假'; break;
                                default : continue;
                            }
                            $('#'+htmlObj).val(leavetypeStr);
                            continue;
                        }
                        if (key == 'file') {
                            var fileStr = '';
                            for (var i = ret['file'].length - 1; i >= 0; i--) {
                                var imgSrc = ServeIp + 'include/data/workflow/' + ret['file'][i];
                                fileStr += '<div class="aui-border aui-text-center file-upload"><img src="'+imgSrc+'" data-preview-src="" data-preview-group="1"></div>';
                            }
                            $('#'+htmlObj).html(fileStr);
                            continue;
                        }
                        $('#'+htmlObj).val(ret[key]);
                    }
                }
                
                
            } else {
                /*toast.success({
                    title:"已加载所有工作",
                    duration:2000
                });
                api.hideProgress();*/
            }
        });
    }

    function show (type) {
        var objId = '';
        switch (type) {
            case '1': objId = 'workflow_leave'; break;
            case '2': objId = 'workflow_outside'; break;
            case '3': objId = 'workflow_travel'; break;
            case '4': objId = 'workflow_reimbursement'; break;
            default : return false;
        }
        document.getElementById(objId).style.display = 'block';
    }

    // 打开窗口
    function openWin(name) {
        api.openWin({
            name: name,
            url: name+'_win.html',
        });
    }

    // 打开frame
    function openFrame (name) {
        api.openFrame({
            name: 'date_detail',
            url: 'date_detail_frm.html',
        });
    }

    
    
</script>
</html>